(library (debug)
  (export debug-peek)

  (import
   (except (rnrs base) let-values map error)
   (only (guile)
         lambda* λ
         call-with-output-string
         simple-format
         current-output-port))

  (define debug-peek
    (lambda* (sth #:optional (message ""))
      (let ([as-string
             (call-with-output-string
               (λ (port)
                 (simple-format port "~a" sth)))])
        (simple-format (current-output-port)
                       "~a~a\n"
                       message
                       as-string)
        sth))))
